//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#pragma once

#include "UI/Animation/Frame/IFrameAnimation.h"

namespace Engine
{
namespace UI
{

	class DummyFrameAnimation;
	SHARED_POINTER( DummyFrameAnimation );


	//
	// Dummy Frame Animation
	//

	class DummyFrameAnimation : public IFrameAnimation
	{
	// variables
	private:
		OnAnimFinishedCallback_t	_cb;
		bool						_started;


	// methods
	private:
		DummyFrameAnimation (const EngineSubSystemsRef ess) :
			IFrameAnimation(ess), _started(false)
		{}


	public:
		void SetDuration (float duration) override
		{}

		void Start (const FramePtr &animatedFrame, const OnAnimFinishedCallback_t &cb) override
		{
			_started = true;
			_cb = cb;
			Stop();
		}

		void Stop () override
		{
			if ( _started ) {
				_cb.Call();
				_started = false;
			}
		}

		void Draw (uint firstFrame, const frame_stack_t &frames, float timeDelta) override
		{
			WARNING( "can not be used" );
		}

		static DummyFrameAnimationPtr New (const EngineSubSystemsRef ess)
		{
			return BaseObject::_New( new DummyFrameAnimation( ess ) );
		}
	};


}	// UI
}	// Engine
